package com.jash.porject;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;


public class NetDrawable extends Drawable {
    private Bitmap bitmap;



    @Override
    public void draw(Canvas canvas) {
        canvas.drawBitmap(bitmap, 0, 0, null);
    }

    @Override
    public void setAlpha(int alpha) {

    }

    @Override
    public void setColorFilter(ColorFilter colorFilter) {

    }

    @Override
    public int getOpacity() {
        return PixelFormat.TRANSPARENT;
    }

    @Override
    public int getMinimumHeight() {
        return super.getMinimumHeight();
    }

    @Override
    public int getMinimumWidth() {
        return bitmap.getWidth();
    }

    public void loadImage(String url) {
        new ImageTask(this).execute(url);
    }

    public void setBitmap(Bitmap bitmap) {
        this.bitmap = bitmap;
        invalidateSelf();
    }
}
